package org.dbi.junit;

import static org.junit.Assert.*;

import org.dbi.beans.Database;
import org.dbi.beans.Constraint;
import org.dbi.beans.Tabel;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class TestDDLRdbms {

	@Before
	public void setUp() throws Exception {
		
	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void testCreateDatabase() {
		Database db = new Database("Database");
		assertEquals("Database", db.getNaam());
	}
	
	@Test
	public void testCreateTableInDatabase() {
		Database db = new Database("Database");
		Constraint grp = new Constraint("grp1");
		Tabel tbl1 = new Tabel("Tabel1",grp);
		db.addSingleTabel(tbl1);
		assertEquals(1, db.getTabellen().values().size());
	}
	
	@Test
	public void testCreateDuplicateTableInDatabase() {
		Database db = new Database("DB1");
		Constraint grp = new Constraint("grp1");
		Tabel tbl1 = new Tabel("Tbl1",grp);
		Tabel tbl2 = new Tabel("Tbl1",grp);
		db.addSingleTabel(tbl1);
		db.addSingleTabel(tbl2);
		assertEquals(1, db.getTabellen().values().size());
		
	
	}
}
